package com.example.demo.tool.fileEnums;

/**
 * @Auter 李孝在
 * @Date 2025/1/18
 */

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashSet;
import java.util.Set;

@Getter
@AllArgsConstructor
public enum FileTypeLimitEnum {
    NO_LIMIT(Set.of()),
    IMAGES(Set.of("jpg", "png", "gif")),
    DOCUMENTS(Set.of("pdf", "doc", "docx")),
    ALL(Set.of("jpg", "png", "gif", "pdf", "doc", "docx"));

    private final Set<String> extensions;


    public static Set<String> getExtensionsForTypes(FileTypeLimitEnum... types) {
        Set<String> combinedExtensions = new HashSet<>();
        for (FileTypeLimitEnum type : types) {
            combinedExtensions.addAll(type.getExtensions());
        }
        return combinedExtensions;
    }
}
